<template>
  <div>
    <selects class="select"></selects>
    <div v-for="(ColumnInfo,index) in ColumnList" :key="index">
      <router-link :to="'/column/'+ColumnInfo.id">
        <ul>
          <li>
            <div class="topImage">
              <img v-if="ColumnInfo.topImage.txt==null" :src="ColumnInfo.topImage.url" alt>
            </div>
            <div class="p">
              <h2 v-text="ColumnInfo.name" class="title"></h2>
              <h3 class="title-p" v-text="ColumnInfo.desc"></h3>
              <p v-text="'￥'+ ColumnInfo.price" class="price"></p>
            </div>
          </li>
        </ul>
      </router-link>
    </div>
    <div class="footer">
      <div class="footer-title">@2010-2016 生活·读书·新知三联书店</div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
import selects from "../components/select";
export default {
  data: function() {
    return {
      ColumnList: []
    };
  },
  components: {
    selects
  },
  mounted() {
    this.getColumn();
  },
  methods: {
    getColumn() {
      var _this = this;
      var API_Proxy = "https://bird.ioliu.cn/v1/?url=";
      axios
        .get(
          API_Proxy +
            // "http://www.songguolife.com/api/activity?page=" + this.ActivityLength + "&pageSize=20")
            "http://www.songguolife.com/api/columns?columnType=1&size=20"
        )
        .then(
          function(data) {
            console.log("请求成功");
            // console.log(data);
            _this.ColumnList = data.data;
            console.log(_this.ColumnList);
          },
          function(err) {
            console.log("请求失败");
            console.log(err);
          }
        );
    }
  }
};
</script>
<style scoped>
ul,
li {
  list-style: none;
}
ul {
  width: 690px;
  margin: 0 auto;
}
li {
  width: 690px;
  height: 240px;
  margin-top: 20px;
}
.topImage {
  width: 220px;
  height: 240px;
  float: left;
}
.p {
  background: #f4f4f4;
  float: right;
  height: 240px;
  width: 470px;
}
.topImage img {
  width: 100%;
  height: 100%;
  display: block;
}
.title {
  color: #333;
  margin: 0;
  padding: 15px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.title-p {
  word-wrap: break-word;
  padding: 15px;
  color: #888;
  margin-top: 30px;
}
.price {
  margin: 0;
  height: 0.2rem;
  padding-right: 0.1rem;
  padding-bottom: 0.04rem;
  float: right;
  color: #c16531;
}
.footer {
  padding-top: 60px;
}
.footer-title {
  margin: 0 auto;
  max-width: 1040px;
  background-color: #f7f4f0;
  padding-top: 40px;
  padding-bottom: 10px;
  padding-left: 70px;
  font-size: 14px;
  text-align: center;
  color: #999;
}
</style>
